/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Jirka
 */
@Entity
@Table(name = "surname")
@NamedQueries({@NamedQuery(name = "Surname.findAll", query = "SELECT s FROM Surname s"), @NamedQuery(name = "Surname.findBySurname", query = "SELECT s FROM Surname s WHERE s.surname = :surname"), @NamedQuery(name = "Surname.findByOrigin", query = "SELECT s FROM Surname s WHERE s.origin = :origin"), @NamedQuery(name = "Surname.findBySurnameId", query = "SELECT s FROM Surname s WHERE s.surnameId = :surnameId")})
public class Surname implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "surname")
    private String surname;
    @Basic(optional = false)
    @Column(name = "origin")
    private String origin;
    @Id
    @Basic(optional = false)
    @Column(name = "surname_id")
    private Integer surnameId;

    public Surname() {
    }

    public Surname(Integer surnameId) {
        this.surnameId = surnameId;
    }

    public Surname(Integer surnameId, String surname, String origin) {
        this.surnameId = surnameId;
        this.surname = surname;
        this.origin = origin;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    public Integer getSurnameId() {
        return surnameId;
    }

    public void setSurnameId(Integer surnameId) {
        this.surnameId = surnameId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (surnameId != null ? surnameId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Surname)) {
            return false;
        }
        Surname other = (Surname) object;
        if ((this.surnameId == null && other.surnameId != null) || (this.surnameId != null && !this.surnameId.equals(other.surnameId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Surname[surnameId=" + surnameId + "]";
    }

}
